/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entitaet;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

/**
 *
 * @author Dennis Wittkoetter <dennis.wittkoetter@hs-osnabrueck.de>
 */
@Entity
public class Bestellung implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int bestNr;
    @Column(nullable=false)
    private String kundenName;
    @OneToMany(cascade={CascadeType.ALL})
    private List<Bestellposten> posten;
    
    public Bestellung() {
        posten = new ArrayList();
    }
    
    public Bestellung(String kundenName) {
        this.kundenName = kundenName;
        this.posten = new ArrayList();
    }
    
    public void bestellpostenHinzufuegen(int pn, int anz) {
        //ToDo
    }

    public Bestellung getBestellung(int bestNr) {
        return this;
    }
    
    public int getBestNr() {
        return bestNr;
    }

    public void setBestNr(int bestNr) {
        this.bestNr = bestNr;
    }

    public String getKundenName() {
        return kundenName;
    }

    public void setKundenName(String kundenName) {
        this.kundenName = kundenName;
    }

    public List<Bestellposten> getPosten() {
        return posten;
    }

    public void setPosten(List<Bestellposten> posten) {
        this.posten = posten;
    }
}
